package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "put_in_storage_details", schema = "jinsanjiao", catalog = "")
public class PutInStorageDetails {
    private int inDetailsId;
    private Long inDetailsQuantity;
    private Inventory inventoryByInventoryNumber;
    private PutInStorage putInStorageByInStorageId;

    @Id
    @Column(name = "in_details_id", nullable = false)
    public int getInDetailsId() {
        return inDetailsId;
    }

    public void setInDetailsId(int inDetailsId) {
        this.inDetailsId = inDetailsId;
    }

    @Basic
    @Column(name = "in_details_quantity", nullable = true, precision = 0)
    public Long getInDetailsQuantity() {
        return inDetailsQuantity;
    }

    public void setInDetailsQuantity(Long inDetailsQuantity) {
        this.inDetailsQuantity = inDetailsQuantity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PutInStorageDetails that = (PutInStorageDetails) o;
        return inDetailsId == that.inDetailsId &&
                Objects.equals(inDetailsQuantity, that.inDetailsQuantity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(inDetailsId, inDetailsQuantity);
    }

    @ManyToOne
    @JoinColumn(name = "inventory_number", referencedColumnName = "inventory_number")
    public Inventory getInventoryByInventoryNumber() {
        return inventoryByInventoryNumber;
    }

    public void setInventoryByInventoryNumber(Inventory inventoryByInventoryNumber) {
        this.inventoryByInventoryNumber = inventoryByInventoryNumber;
    }

    @ManyToOne
    @JoinColumn(name = "in_storage_id", referencedColumnName = "in_storage_id")
    public PutInStorage getPutInStorageByInStorageId() {
        return putInStorageByInStorageId;
    }

    public void setPutInStorageByInStorageId(PutInStorage putInStorageByInStorageId) {
        this.putInStorageByInStorageId = putInStorageByInStorageId;
    }
}
